import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  ManyToOne,
  OneToMany,
} from 'typeorm';
import { consumptionType } from '@/modules/consumption-type/entities/consumption-type.entity';
import { Course } from '@/modules/course/models/course.entity';
import { reservation } from '@/modules/reservation/entities/reservation.entity';

@Entity()
export class consumption {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  count: number;

  @Column()
  useCount: number;

  @Column()
  createTime: Date;

  @Column()
  effective: Date;
  @Column()
  state: boolean;

  @ManyToOne(() => consumptionType, (consumptionType) => consumptionType.id)
  type: consumptionType;

  @ManyToOne(() => Course, (Course) => Course.id)
  course: Course;

  @OneToMany(() => reservation, (reservation) => reservation.reservation)
  reservation: reservation;

  @Column()
  preferentialPrice: number;

  @Column()
  originalPrice: number;
}
